<?php

$sBrowserClass = "";
$style = "";
$js = "";
$file_name =  $_SERVER['SCRIPT_FILENAME'];
$template = "/^.*\/([^\/]+)\.php$/m";
preg_match($template, $file_name, $name_short);
$title = '<title>Игра Шляпа</title>';

if (preg_match("/Opera\W*(\d+(:?\.\d+)?)/",@$_SERVER["HTTP_USER_AGENT"], $aMatch)) {
    $sBrowserClass = "isOpera";
    if (@$aMatch[1] && $aMatch[1] < 9) {
        $sBrowserClass .= " isOpera8";
    }
}
elseif (preg_match("/MSIE\W*(\d+(:?\.\d+)?)/",@$_SERVER["HTTP_USER_AGENT"], $aMatch)) {
    $sBrowserClass = "isIE";
    if (@$aMatch[1] && $aMatch[1] < 7) {
        $sBrowserClass .= " isIE6";
    }
}
elseif (preg_match("/Chrome\W*(\d+(:?\.\d+)?)/",@$_SERVER["HTTP_USER_AGENT"], $aMatch)) {
    $sBrowserClass = "isChrome";
    if (@$aMatch[1] && $aMatch[1] < 7) {
        $sBrowserClass .= " isChrome";
    }
}
elseif (preg_match("/Safari\W*(\d+(:?\.\d+)?)/",@$_SERVER["HTTP_USER_AGENT"], $aMatch)) {
    $sBrowserClass = "isSafari";
    if (@$aMatch[1] && $aMatch[1] < 7) {
        $sBrowserClass .= " isSafari";
    }
}

if ($sBrowserClass) {
    $sBrowserClass = ' class="' . $sBrowserClass . '"';
}


switch($name_short[1]){
    case "index":{
        $title = '<title>Игра Шляпа - Выбрать слова для игры Шляпа</title>';
        $style = '<link href="../css/index.css" rel="stylesheet" type="text/css" media="screen">';
        $js = '<script type="text/javascript" src="../js/indexPage.js"></script>';
        break;
    }
    case "new":{
        $title = '<title>Добавить слово в Шляпу</title>';
        $style = '<link href="../css/new_word.css" rel="stylesheet" type="text/css" media="screen">';
        $js = '<script type="text/javascript" src="../js/newWordPage.js"></script>';
        break;
    }
    case "admin":{
        $title = '<title>Админ</title>';
        $style = '<link href="../css/admin.css" rel="stylesheet" type="text/css" media="screen">';
        $js = '<script type="text/javascript" src="../js/adminPage.js"></script>';
        break;
    }
    case "about":{
        $title = '<title>О сайте Шляпы</title>';
        $style = '<link href="../css/about.css" rel="stylesheet" type="text/css" media="screen">';
        $js = '<script type="text/javascript" src="../js/aboutPage.js"></script>';
        break;
    }
    case "rules":{
        $title = '<title>Правилы игры Шляпа</title>';
    }
    default:{}
};
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8">--> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="shortcut icon" href="http://localhost/SVN/www/favicon.ico" type="image/x-icon">
        <link rel="icon" href="http://localhost/SVN/www/favicon.ico" type="image/x-icon">
        
        <? echo $title?>
        
        <link href="../css/common.css" rel="stylesheet" type="text/css" media="screen">
        <? echo $style ?>
        
        <link href="../css/print.css" rel="stylesheet"  type="text/css" media="print">

        <!--for vkontakte likes-->
        <script type="text/javascript" src="http://userapi.com/js/api/openapi.js?48"></script>
        <script type="text/javascript">
            VK.init({apiId: 2835144, onlyWidgets: true});
        </script>
        
        <meta name="description" content="Шляпа - веселая игра для компании от 4-х и более человек. Вы можете посмотреть или распечатать слова для игры в Шляпу у нас на сайте.">
        <meta name="keywords" content="shlyapa, шляпа, игра, шапка, слова">
    </head>
    
    <body <?echo $sBrowserClass?>>
        <script type="text/javascript" src="../jquery/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="../js/common.js"></script>
        <? echo $js ?>
        
        <div class="print_content">
            <div id="logo">
                <img id="prnt_logo" src="../css/image/logo_print.png" alt="logo_hat">
            </div>
            <div id="site_name">
                www.shlyapa-game.com
            </div>
            <div class="clear"></div>
        </div>
        <div id="container" class="noprint">
            <div id="header">
                <!--Rating@Mail.ru counter-->
                    <script type="text/javascript" language="javascript"><!--
                        d=document;var a='';a+=';r='+escape(d.referrer);js=10;//-->
                    </script>
                    <script type="text/javascript" language="javascript1.1"><!--
                        a+=';j='+navigator.javaEnabled();js=11;//-->
                    </script>
                    <script type="text/javascript" language="javascript1.2"><!--
                        s=screen;a+=';s='+s.width+'*'+s.height;
                        a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth);js=12;//-->
                    </script>
                    <script type="text/javascript" language="javascript1.3"><!--
                        js=13;//-->
                    </script>
                    <script type="text/javascript" language="javascript"><!--
                        d.write('<img src="http://d3.c2.b1.a2.top.mail.ru/counter'+'?id=2171650;js='+js+
                        a+';rand='+Math.random()+'" height="1" width="1" alt="top.mail.ru" border="0">');
                        if(11<js)d.write('<'+'!-- ');//-->
                    </script>
                    <noscript>
                        <img src="http://d3.c2.b1.a2.top.mail.ru/counter?js=na;id=2171650" 
                        height="1" width="1" alt="top.mail.ru" border="0">
                    </noscript>
                    <script type="text/javascript" language="javascript"><!--
                        if(11<js)d.write('--'+'>');//-->
                    </script>
                <!--// Rating@Mail.ru counter-->
                
                <div class="clear"></div>
                
                
                  <div id="menu">
                        <table id="headerTable">
                           <tr>
                                <td id="logo_td">
                                     <img id="logo_image" src="../css/image/logo.png" alt="logo_hat">
                                </td>
                                <td>
                                   <div class="link"> <a href="http://localhost/SVN/www/index/">Главная</a></div>
                                </td>
                                <td>
                                    <div class="link"><a href="http://localhost/SVN/www/new/">Добавить слово</a></div>
                                </td>
                                <td>
                                    <div class="link"><a href="http://localhost/SVN/www/rules/">Правила игры</a></div>
                                </td>
                                <td>
                                   <div class="link"> <a href="http://localhost/SVN/www/about/">О сайте</a></div>
                                </td>
                            </tr>
                        </table>
                    </div>
            <div class="clear"></div>
            </div>
